From c5ea66cfd2e0c9fed12f529c4ae084527456c0b5 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Tue, 20 Dec 2005 17:16:15 +0000 Subject: [PATCH] Changed UUID / Xen handle formatting to be compatible with the OSF DCE UUIDs. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/uuid.py | 12 +++++++++--- xen/common/keyhandler.c | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/python/xen/xend/uuid.py b/tools/python/xen/xend/uuid.py index 2bf514c67d..401540bc6e 100644 --- a/tools/python/xen/xend/uuid.py +++ b/tools/python/xen/xend/uuid.py @@ -17,8 +17,13 @@ #============================================================================ -"""Universal(ly) Unique Identifiers (UUIDs). -""" +"""Universal Unique Identifiers (UUIDs). By default, UUIDs generated here are +purely random, with no internal structure. However, they are the same size, +and are formatted by the same conventions, as the UUIDs in the Open Software +Foundation's Distributed Computing Environment (OSF DCE). This allows Xend to +be used with UUIDs generated as per the DCE specification, should that be +required. These UUIDs are also, by no coincidence, the same size as the +'handle' stored by the Xen hypervisor along with the domain structure.""" import commands @@ -54,7 +59,8 @@ def create(): def toString(u): - return "-".join(["%02x" * 4] * 4) % tuple(u) + return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2, + "%02x" * 6]) % tuple(u) def fromString(s): s = s.replace('-', '') diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index acbfd094bc..7f569d99fb 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -112,8 +112,11 @@ static void do_task_queues(unsigned char key) printk("Xen: DOM %u, flags=%lx refcnt=%d nr_pages=%d " "xenheap_pages=%d\n", d->domain_id, d->domain_flags, atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages); - printk(" handle=%02x%02x%02x%02x-%02x%02x%02x%02x-" - "%02x%02x%02x%02x-%02x%02x%02x%02x\n", + /* The handle is printed according to the OSF DCE UUID spec., even + though it is not necessarily such a thing, for ease of use when it + _is_ one of those. */ + printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x-%02x%02x%02x%02x%02x%02x\n", d->handle[ 0], d->handle[ 1], d->handle[ 2], d->handle[ 3], d->handle[ 4], d->handle[ 5], d->handle[ 6], d->handle[ 7], d->handle[ 8], d->handle[ 9], d->handle[10], d->handle[11], -- 2.30.2